<?php

/* @var $this yii\web\View */

$this->title = "首页";
?>
<div class="site-index">

    <!--<div class="jumbotron">
        <h1>Congratulations!</h1>

        <p class="lead">You have successfully created your Yii-powered application.</p>

        <p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>
    </div>-->

    <div class="body-content">

        <div class="row">
            <?php if (Yii::$app->user->isGuest): ?>
                <div class="col-lg-12">
                    <p>
                        <b>请登陆后获取所需说明</b>
                    </p>
                </div>
            <?php else: ?>
                <div class="col-lg-12">
                    <h2>需要的认证参数</h2>
                    <p>
                        <code>token</code> 用户的token <br>
                        <code>timestamp</code> 当前时间戳 <br>
                        <code>nonce</code> 随机数 [最近的几次请求随机数不能相同] <br>
                        <code>signature</code> 签名摘要
                        [md5(<code>token</code>.<code>timestamp</code>.<code>nonce</code>.<code>sign_key</code>)]
                        其中<code>sign_key</code>为用户的签名钥匙，不要泄露，一旦泄露请马上更改
                        <br>
                        <br>

                        <b>以上参数请在header里提交</b>
                    </p>
                </div>
                <hr>
                <div class="col-lg-12">
                    <h2>用户信息</h2>
                    <div class="row">
                        <div class="col-lg-12">
                            <h4>本系统所需参数</h4>
                            <p>
                                <code>token</code>: <?= Yii::$app->user->identity->token ?>
                                <br>
                                <code>sign_key</code>: <?= Yii::$app->user->identity->sign_key ?>
                                <?= \kartik\helpers\Html::a('更换', ['/user/default/update-sign-key'], [
                                    'class' => 'btn btn-danger btn-xs',
                                    'data' => [
                                        'confirm' => "你确定要更换签名钥匙吗？"
                                    ],
                                    'data-method' => 'post',
                                ]) ?>
                            </p>
                        </div>
                    </div>

                </div>
                <hr>
                <div class="col-lg-12">
                    <h2>api文档</h2>
                    <p>
                        测试url: <code>http://test.api.qiche100.com</code>
                    </p>
                    <p>
                        生产url: <code>http://api.qiche100.com</code>
                    </p>
                    <p>
                        <a href="<?= Yii::$app->params['api_domain'] . '/route/api/index' ?>" target="_blank">api文档</a>
                    </p>
                </div>
                <hr>
                <div class="col-lg-12">
                    <h2>可以操作的api路由</h2>
                    <p>
                        <?php foreach (Yii::$app->user->identity->allApiRouteArr as $k => $v): ?>
                            <code><?= $v ?></code>
                        <?php endforeach; ?>
                    </p>
                </div>
            <?php endif; ?>
        </div>

    </div>
</div>
